<template>
	<view>
		<u-alert :title="title" type="warning" closable description="请注意: 未登录时分享或者直接转发别人的分享卡片进行分享的均不会算在您的邀请里面">
		</u-alert>
		<uni-card title="规则一" extra="分享得佣金">
			<text>您在登录小程序后，任意界面点击右上角分享小程序给微信朋友，朋友点击进来购买拼单商品或体验采摘蔬菜后，您即可获得佣金，邀请的朋友越多，佣金越多(佣金结算周期为用户购买的商品确认收货一个星期后)</text>
		</uni-card>
		<uni-card title="规则二" extra="推广得佣金">
			<text>任意页面点击右上角页面分享小程序,好友点击链接进来登录入驻为商家,当本月邀请商家10人或10人以上成功入驻，并且他们的总拼单交易流水大于{{money}}时，则每月月底系统会自动按照{{cost*100}}%的比例给您进行提成结算</text>
		</uni-card>
		<!-- <view class="wallBox " style="margin-top: 40rpx;height: 132px;font-size: 15px;color: #797979;">
			
			
		</view> -->
		<uni-card title="我邀请的用户" spacing="0px 5px" padding="0px 0px">
			<u-list @scrolltolower="reachBottom()" showScrollbar="false" height="38vh">
				<u-list-item v-for="(item, index) in list" :key="index">
					<view class="box">
						<view class="remark">
							<u--image :src="item.avatar" shape="circle" width="80rpx" height="80rpx"></u--image>
							<view class="nick">
								{{item.nick}}
							</view>
							<view style="margin-left: 20rpx;margin-top: 20rpx;">
								<u-tag text="商家" size="mini" v-if="item.merchantId"></u-tag>
								<u-tag text="普通用户" size="mini" v-else type="success"></u-tag>
							</view>
						</view>
						<view class="time">
							<view style="height: 18rpx;">
								<text>邀请时间</text>
							</view>
							<text>{{getTime(item.createTime)}}</text>
						</view>
					</view>
					<u-line length="85%" margin="0rpx 0rpx 0rpx 130rpx"></u-line>
				</u-list-item>
				<u-loadmore :status="loadDate.status" :loading-text="loadDate.loadingText"
					:loadmore-text="loadDate.loadmoreText" :nomore-text="loadDate.nomoreText" />
			</u-list>
		</uni-card>

	</view>
</template>

<script>
	import SOtime from "../../js_sdk/fl-SOtime/SOtime.js"
	export default {
		data() {
			return {
				cost: "",
				money: "",
				list: [],
				params: {
					pageNo: 1,
					pageSize: 15
				},
				loadDate: {
					ifBottomRefresh: false,
					status: 'loadmore',
					loadingText: '努力加载中~',
					loadmoreText: '轻轻上拉~',
					nomoreText: '没有数据了~'
				},
			}
		},
		onShow() {
			this.getList()
			this.reParam()
		},
		methods: {
			reParam() {
				this.$axios({
					url: "user/info/reParam",
					method: "post"
				}).then((res) => {
					this.money = res.result.money
					this.cost = res.result.cost
				})
			},
			reachBottom() {
				if (this.loadDate.status != 'noMore') {
					this.loadDate.status = 'loading';
					this.loadDate.ifBottomRefresh = true
					//正式服去掉这个延时器
					this.getList()
				}
			},
			getList() {
				this.$axios({
					url: "user/info/myUserList",
					method: "post",
					data: {
						...this.params
					}
				}).then((res) => {
					//请求接口成功之后，判断加载状态，处理数据
					if (res.result.pages >= this.params.pageNo) {
						if (this.loadDate.ifBottomRefresh) {
							this.list = this.list.concat(res.result.list)
						} else {
							this.list = res.result.list
						}
					} else {
						this.loadDate.status = 'noMore'
					}
					if (this.params.pageNo >= res.result.pages) {
						this.loadDate.status = 'noMore'
					}
					this.params.pageNo++;
				})
			},
			getTime(time) {
				return SOtime.time3(time)
			}

		}
	}
</script>

<style lang="scss" scoped>
	page {
		// background-color: #fff;
	}

	.wallBox {
		display: flex;
		align-items: center;
		/* justify-content: space-between; */
		/* justify-content: space-around; */
		margin: 0 auto;
		margin-bottom: 20rpx;
		background-color: #fff;
		border-radius: 20rpx;
		height: 160rpx;
		padding: 0rpx 40rpx 0rpx 30rpx;
	}

	.box {
		display: flex;
		height: 40rpx;
		padding: 25rpx 40rpx 55rpx 40rpx;

		.time {
			margin-top: 11rpx;
			margin-left: auto;
			font-size: 7px;
			color: #b1b1b1;
			width: 146rpx;
		}

		.remark {
			display: flex;
			width: 500rpx;

			.nick {
				margin-left: 30rpx;
				font-size: 18rpx;
				color: #6b6b6b;
				font-weight: 900;
				line-height: 70rpx;
			}
		}
	}

	/deep/.u-tag--mini.data-v-3732d7af {
		height: 14px;
	}

	/deep/.u-tag__text--mini.data-v-3732d7af {
		font-size: 9px;
		line-height: 12px;
	}
</style>
